package com.magenta.maxoptra.gis.service;

import com.magenta.maxoptra.dto.GeoLocationRecord;
import com.magenta.maxoptra.gis.*;
import org.jetbrains.annotations.Nullable;

import javax.ejb.EJB;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import java.util.List;
import java.util.UUID;

/**
 * Created with IntelliJ IDEA.
 * User: KuznetsovD
 * Date: 03.10.13
 * Time: 17:18
 * To change this template use File | Settings | File Templates.
 */
@Stateless(name = SyncGeoroutingServiceRemote.JNDI_NAME)
@Remote({SyncGeoroutingServiceRemote.class})
public class SyncGeoroutingServiceRemoteImpl implements SyncGeoroutingServiceRemote {

    @EJB
    SyncGeoRoutingService syncGeoRoutingService;

    @Override
    public GeoRoute getFastestRoute(@Nullable UUID userId, GeoProviderSettings settings, GeographicCoordinates from, GeographicCoordinates to) {
        return syncGeoRoutingService.getFastestRoute(settings, from, to);
    }

    @Override
    public List<GeoLocationRecord> getRoutePoints(@Nullable UUID userId, GeoProviderSettings settings, GeographicCoordinates from, GeographicCoordinates to, boolean calculateDistance) throws GeoException {
        return syncGeoRoutingService.getRoutePoints(settings, from, to, calculateDistance);
    }

    @Override
    public GeoProviderStatus updateCache(@Nullable UUID userId, GeoProviderSettings settings, RoutingCoordinate from, RoutingCoordinate to, int delayBeforeRequests) {
        return syncGeoRoutingService.updateCache(settings, from, to, delayBeforeRequests);
    }

    @Override
    public GeoProviderStatus updateCache(@Nullable UUID userId, GeoProviderSettings settings, GeographicCoordinates origin, List<? extends GeographicCoordinates> destinations, int delayBeforeRequests) {
        return syncGeoRoutingService.updateCache(settings, origin, destinations, delayBeforeRequests);
    }

    @Override
    public GeoRoute getRoute(@Nullable UUID userId, GeoProviderSettings settings, List<GeographicCoordinates> coordinates) throws GeoException {
        return syncGeoRoutingService.getRoute(settings, coordinates);
    }

    @Override
    public List<GeoLocationRecord> getRoutePoints(@Nullable UUID userId, GeoProviderSettings settings, List<GeographicCoordinates> points) throws GeoException {
        return syncGeoRoutingService.getRoutePoints(settings, points);
    }

    @Override
    public void updateCache(@Nullable UUID userId, GeoProviderSettings settings, RoutingCoordinate from, List<RoutingCoordinate> points) {
        syncGeoRoutingService.updateCache(settings, from, points);
    }

    @Override
    public void updateCache(@Nullable UUID userId, GeoProviderSettings settings, List<RoutingCoordinate> from, List<RoutingCoordinate> to) {
        syncGeoRoutingService.updateCache(settings, from, to);
    }

    @Override
    public long cleanAndGetDateOfFirstOldest(@Nullable UUID userId, long cid, long maxAge) {
        return syncGeoRoutingService.cleanAndGetDateOfFirstOldest(cid, maxAge);
    }

    @Override
    public List<GeoRoute> getCoordinateToCoordinateRoutes(@Nullable UUID userId, GeoProviderSettings settings, List<GeographicCoordinates> coordinates) {
        return syncGeoRoutingService.getCoordinateToCoordinateRoutes(settings, coordinates);
    }
}
